//
//  OMPersonalCenterViewController.m
//  OMENGO
//
//  Created by 梁尚嘉 on 2016/12/6.
//  Copyright © 2016年 Kamfat. All rights reserved.
//

#import "OMPersonalCenterViewController.h"

#import "OMPersonalCenterBar.h"
#import "OMPCUserInfoBar.h"
#import "OMPersonalCenterCategoryTableCell.h"
#import "OMPCTableCell.h"

#import "NSString+KTExt.h"

@interface OMPersonalCenterViewController ()
@end

@implementation OMPersonalCenterViewController {
    NSArray *_sectionIndiators;
    NSArray *_imageIndicators;
    NSArray *_descIndicators;
    NSArray *_section0indicators;
    NSArray *_image0Indicators;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.

    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        [self configure];
    });

}


- (void)configure
{

    self.navigationBarHidden = true;

    //[self.tableView beginUpdates];
    self.tableView.tableHeaderView = [OMPersonalCenterBar customeBar];
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
    //[self.tableView endUpdates];
    UIView *footer = [[UIView alloc]initWithFrame:CGRectMake(0, 0, SM_SCREEN_WIDTH, SM_SIZE(300))];
    self.tableView.tableFooterView = footer;

    NSMutableAttributedString *contactAttributed = [[NSMutableAttributedString alloc]initWithString:@"联系客服 "
                                                                                         attributes:@{NSForegroundColorAttributeName:SM_grayColor}];
    [contactAttributed appendAttributedString:[[NSAttributedString alloc] initWithString:@"400-930-2220"
                                                                              attributes:@{NSForegroundColorAttributeName:[UIColor colorWithRed:0 green:0.52 blue:0.88 alpha:1]}]];
    UIButton *contactBtn = [UIButton new];
    contactBtn.titleLabel.font = SM_CFont(25);
    [contactBtn setAttributedTitle:contactAttributed forState:UIControlStateNormal];
    [footer addSubview:contactBtn];
    [contactBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(footer.mas_centerX);
        make.bottom.equalTo(@(SM_SIZE(-20)));
    }];
    [[contactBtn rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(id x) {
        [@"400-930-2220" makeCall];
    }];

}




#pragma mark - tableview delegate
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 1;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return [OMPersonalCenterCategoryTableCell tableViewCellWithTableView:tableView];
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return [OMPersonalCenterCategoryTableCell cellHeight];
}



@end
